<template>
  <lay-card style="margin: 10px">
    <lay-result status="success" title="绑定成功" describe="never give up!!!" style="margin-top: 100px">
      <template #content> 
        <div class="content">
          {{outData.nickName}}，欢迎使用本平台。
        </div>
      </template>
      <template #extra>
        <lay-button type="primary" v-on:click="closeCurPage">我已知晓</lay-button>
        <lay-button >去官网</lay-button>
      </template>
    </lay-result>
  </lay-card>
</template>
<script setup lang="ts">
import {ref, onMounted} from 'vue'
import { useRoute } from 'vue-router'
const route = useRoute()

const outData = ref({
  nickName: ''
})

onMounted(()=>{
  outData.value.nickName = <string>route.query.nickName
})

// 在微信公众号中关闭页面：https://www.jianshu.com/p/6c3c2d3cbe43
const closeCurPage = ()=>{
  document.addEventListener('WeixinJSBridgeReady', function() {
    WeixinJSBridge.call('closeWindow');
  }, false);
  WeixinJSBridge.call('closeWindow');
}

</script>

<style scoped>
.content {
  text-align: left;
  background: #fafafa;
  border-radius: 4px;
  padding: 20px;
}
</style>